1. Field of the Invention
The present invention relates to a new and improved picture generating system and, more particularly, to a method and apparatus for mapping texture data of three-dimensional computer graphics (3DCG) with a relatively inexpensive structure at high speed.
2. Description of the Related Art
In recent years, application fields for 3DCG systems have been expanding drastically. The 3DCG systems have been used not only for CAD systems, but also for cinemas, picture production, video games, and the like. Such 3DCG systems require the capabilities of not only displaying a three-dimensional shape of an object on a two-dimensional screen, but also providing a picture with a much higher degree of reality. As a technique for improving the expression of graphics, texture mapping techniques are known in the prior art. In such texture mapping techniques, a picture, a pattern, or the like is embedded for an object. The object is composed of a plurality of polygons such as a triangle or a square. The texture mapping is performed for each polygon units. In some 3DCG systems, the texture mapping technique is accomplished with hardware.
In the structure of a conventional picture generating apparatus, there is typically provided an interpolating unit (hereinafter, referred to as the DDA (Digital Differential Analyzer) that linearly interpolates a color value and a coordinate value. A texture memory unit (hereinafter, referred to as the TBUF unit) provides memory for texture data. A Z coordinate memory unit (hereinafter, referred to as the ZBUF unit) provides a memory for a Z coordinate value used for removing a hidden surface. A drawing data memory unit (hereinafter, referred to as the FBUF unit) provides a memory for drawing data. A texture mapping unit (hereinafter, referred to as the TMAP unit) converts texture coordinates corresponding to each drawing pixel obtained by the DDA unit into a physical address of the TBUF unit and maps the texture data. A memory interface unit (hereinafter, referred to as the MEMIF unit) that reads/writes a Z coordinate value from/to the ZBUF unit and reads/writes drawing data from/to the FBUF unit.
Also provided are a signal line for setting a parameter and for loading texture data, signal lines for sending data to the next stage, a signal line for sending display data to a display system, a bus for loading and reading texture data. A bus for reading/writing a Z coordinate value, and a bus for reading/writing drawing data.
In accordance with the operation of the above-described conventional picture generating apparatus, parameters necessary for linearly interpolating screen coordinates, a color value, and texture coordinates corresponding to a primitive such as a triangle are set to the DDA unit. The DDA unit linearly interpolates screen coordinates, a color value, and texture coordinates with such parameters so as to calculate screen coordinates, color value, and texture coordinates for each drawing pixel. The TMAP unit converts the texture coordinates obtained by the DDA unit into a physical address of the TBUF unit, reads the texture data from the TBUF unit, and maps the texture data for each drawing pixel.
The MEMIF unit typically reads a Z coordinate value stored in the ZBUF unit with (X, Y) coordinates of the drawing pixel of which the texture data has been mapped by the TMAP unit and compares the Z coordinate value with that of the drawing pixel. When they match, the MEMIF unit rewrites the Z coordinate value to the ZBUF unit. At this point, if necessary, the drawing data stored in the FBUF unit is read with the (X, Y) coordinates of the drawing pixel. The drawing data and the color value of the drawing pixel are logically operated. The resultant color value is written to the FBUF unit. When data is displayed, the MEMIF unit successively reads drawing data from the FBUF unit and sends the drawing data to the display system through the signal line D4.
In another conventional picture generating apparatus. In texture data maybe stored in free areas of a ZBUF unit that stores a Z coordinate value and an FBUF unit that stores drawing data. In addition, the TMAP unit that maps texture data of each drawing pixel includes a texture cache unit (hereinafter, referred to as the TCACHE unit) that stores a part of the texture data. A signal line is provided for sending texture data that has been read from the ZBUF unit and the FBUF unit to the TCACHE unit.
The operation of the aforedescribed second conventional picture generating apparatus is the same as the operation of the first conventional apparatus previously described except for the texture mapping operation.
In this regard, texture data is divided into a square area with the size corresponding to a TCACHE unit. Since the TCACHE unit is composed of an SRAM, the storage capacity thereof is relatively small. The texture data is stored in free areas of the ZBUF unit and the FBUF unit. When texture data corresponding to a drawing pixel is present in the TCACHE unit, the TMAP unit reads the texture data from the TCACHE unit and maps the texture data for the drawing pixel. When texture data corresponding to the drawing pixel is not present in the TCACHE unit, the TMAP unit successively reads square areas of the texture data from the ZBUF unit or the FBUF unit, loads the square areas to the TCACHE position, and then maps the texture data of the drawing pixel.
In a third conventional picture generating apparatus texture data is processed in parallel. A DDA unit linearly interpolates a color value and a coordinate value. TBUF units provide memories for texture data. ZBUF units provide memories for Z coordinate values used for removing a hidden surface. FBUF units provide memories for drawing data. TMAP units convert texture coordinates of each drawing pixel obtained by the DDA unit into physical addresses of the DDA units. MEMIF units read/write Z coordinate values from/to the ZBUF units and read/write drawing data from/to the FBUF units.
A signal line is provided for setting a parameter and loading texture data. Signal lines are also for sending data to the next stage. In addition there is a signal line for sending display data to the display system. Also provided are buses for loading and reading texture data, buses for reading/writing z coordinate values, and buses for reading/writing drawing data.
In accordance with the operation of the aforedescribed third conventional picture generating apparatus, parameters necessary for linearly interpolating screen coordinates, a color value, and texture coordinates corresponding to a primitive such as a triangle are set to the DDA unit. The DDA unit linearly interpolates screen coordinates, a color value, and texture coordinates with the parameters. At this point, the Y coordinate value of the screen coordinates is an even value. In other words, drawing pixels of even scan lines and Y coordinate values of the screen coordinates are odd values. Drawing pixels of odd scan lines are processed at the same time so as to calculate the screen coordinates, color value, and texture coordinates of each drawing pixel.
The TMAP unit converts texture coordinates of drawing pixels of even scan lines obtained by the DDA unit into physical addresses of the TBUF unit, reads texture data from the TBUF unit, and maps the texture data of the drawing pixels. The TMAP unit converts texture coordinates of drawing pixels of odd scan lines obtained by the DDA unit into physical addresses of the TBUF unit, reads texture data from the TBUF unit, and maps the texture data of the drawing pixels.
The MEMIF unit reads a Z coordinate value stored in the ZBUF unit with the (X, Y) coordinates of each drawing pixel of the even scan lines of which texture data has been mapped by the TMAP unit and compares the Z coordinate values with that of the drawing pixel. When they match, the MEMIF unit rewrites the Z coordinate value of the drawing pixel to the ZBUF unit. At this point, if necessary, with the (X, Y) coordinates of the drawing pixel, drawing data stored in the FBUF unit is read. The drawing data and the color value of the drawing pixel are logically operated. Thereafter, the resultant color value is written to the FBUF unit.
The MEMIF unit reads the Z coordinate value stored in the ZBUF unit with the (X, Y) coordinates of each drawing pixel of the odd scan lines of which texture data has been mapped by the TMAP unit and compares the Z coordinate value with that of the drawing pixel. When they match, the MEMIF unit rewrites the Z coordinate value of the drawing pixel to the ZBUF unit. At this point, if necessary, with the (X, Y) coordinates of the drawing pixel, the drawing data is read from the FBUF unit. The drawing data and the color value of the drawing pixel are logically operated. The resultant color value is written to the FBUF unit. When data is displayed, the MEMIF units successively read drawing data from the FBUF units and send the drawing data to the display system through a signal line.
As described above, the ZBUF units store data of even scan lines. The ZBUF units store data of odd scan lines.
Texture data is stored in the TBUF units. Regarding the relation between screen coordinates and texture coordinates, when only the X coordinate, not the Y coordinate is varied on the screen coordinates, both the U and V coordinates vary. In addition, the amounts of changes of the U and V coordinates are not constant. Thus, since texture data cannot be categorized as drawing pixels of even scan lines and odd scan lines, the same texture data is redundantly stored in the TBUF units.
Accordingly, in the first conventional picture generating apparatus described above, texture data is stored in a dedicated texture memory. Thus, in the case of an application that does not use the Z buffer method, an application that draws a picture with a single buffer, or an application with a small display area, even if a memory that stores a Z coordinate value and a memory that stores drawing data have free areas, texture data cannot be flexibly stored.
In the second of the conventional picture generating apparatus described above, although data can be flexibly stored, when desired texture data is not present in the TCACHE unit, unless a square area of desired texture data is sent from the ZBUF unit to the TCACHE unit, the texture data cannot be mapped. In addition, during this period, since the ZBUF unit is not accessed, the performance of the apparatus is deteriorated.
In the third conventional picture generating apparatus described above, since the same texture data is redundantly stored, the cost thereof increases.
Accordingly, there has been a long existing need for enhanced image data processing which solves the problems of the conventional picture generating apparatuses of the prior art and to provide a picture generating apparatus that can flexibly map texture data with a relatively inexpensive structure and at a high speed. The present invention clearly fulfills these needs.